package com.tianyiyan.tyenword;

import com.tianyiyan.hibernate.tyenword.Phrase;
import com.tianyiyan.hibernate.tyenword.PhraseMeaning;
import com.tianyiyan.hibernate.tyenword.Word;

public class Elem
{
	private Integer id;
	private String val;
	private String elemType;
	
	public static final String ELEM_WORD = "w";
	public static final String ELEM_PHRASE = "p";
	public static final String ELEM_WORD_MEANING = "wm";
	public static final String ELEM_PHRASE_MEANING = "pm";
	
	public Elem(){}
	
	public Elem(Word w)
	{
		id = w.getId();
		val = w.getVal();
		elemType = ELEM_WORD;
	}
	
	public Elem(Phrase p)
	{
		id = p.getId();
		val = p.getVal();
		elemType = ELEM_PHRASE;
	}
	
	public Elem(Integer id, String val, String elemType)
	{
		this.id = id;
		this.val = val;
		this.elemType = elemType;
	}
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getVal() {
		return val;
	}
	public void setVal(String val) {
		this.val = val;
	}
	public String getElemType() {
		return elemType;
	}
	public void setElemType(String elemType) {
		this.elemType = elemType;
	}
	
	@Override
	public String toString() {
		return "Elem [id=" + id + ", val=" + val + ", elemType=" + elemType
				+ "]";
	}
}
